<?php
require_once dirname(__FILE__).'/include.php';
Master::loadCoreClass("AdminControl");
$Admin = new AdminControl();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=Config::$siteName ?></title>    
<?php
require_once dirname(__FILE__).'/heard.php';
?> 
<script type="text/javascript" src="scripts/jquery.beautyOfCode.js"></script>
</head>
<body>
<?php
if (Get::getByKey('action')=='save')
{		
	$act = array('Add'=>'新增','List'=>'列表','Edit'=>'编辑','Del'=>'删除','View'=>'查看');
	foreach($act as $key=>$v )
	{
		$Admin->delete('admins_node',array('names'=>$key.Post::getByKey('tableName')));
		$Admin->insert('admins_node',array('names'=>$key.Post::getByKey('tableName'),'title'=>Post::getByKey('tableNameCN').'-'.$v,'status'=>1,'remark'=>Post::getByKey('tableNameCN'),'pid'=>0,'level'=>1));
	}
	Header("Location:adminhelper.php");
}
$model = $Admin->selectSingle('tableitems',array('tableName'=>Get::getByKey('tableName')));
?>
<div class="content-box column-left">
	<div class="content-box-header">
		<h3>控制器：</h3>
	</div> 
	<div class="content-box-content">
		<div class="tab-content default-tab">
			<p>
				<pre class="code">
				  <code class="php">
			   //'***************************************************
			   //' <?=$model->tableNameCN?>表操作 表:<?=$model->tableName?>  操作:Save,Del,List,Model
			   //'***************************************************    
				 //新增
				public function create<?=$model->tableName?>()
				{
					ControlHelp::checkRbac('Add<?=$model->tableName?>');
					return ControlHelp::SaveModel("<?=$model->tableName?>");
				}
				//修改
				public function edit<?=$model->tableName?>()
				{
					ControlHelp::checkRbac('Edit<?=$model->tableName?>');
					return ControlHelp::SaveModel("<?=$model->tableName?>");
				}
				//删除
				public function del<?=$model->tableName?>($id)
				{
					ControlHelp::checkRbac('Del<?=$model->tableName?>');
					$mydb = new DataBaseObject();
					return $Admin->delete('<?=$model->tableName?>',array('ID' => $id ));
				}
				//列表
				public function list<?=$model->tableName?>($whstr= array())
				{
					ControlHelp::checkRbac('List<?=$model->tableName?>');
					return ControlHelp::listModel('<?=$model->tableName?>',$whstr);
				}
				//实体
				public function modle<?=$model->tableName?>($id)
				{
					ControlHelp::checkRbac('View<?=$model->tableName?>');
					$mydb = new DataBaseObject();     
					return $Admin->selectSingle('<?=$model->tableName?>',array('id'=>$id));
				}  	
				</code>							
			</pre>
			</p>
		</div> 
	</div> 
</div>
<div class="content-box column-right">
	<div class="content-box-header"> 
		<h3>表单，调用，示例</h3>
	</div> 
	<div class="content-box-content">
		<div class="tab-content default-tab">
			<p>
			</p>
		</div> 
	</div> 
</div>	
</body>  
</html>
	<script type="text/javascript">
		$.beautyOfCode.init({
			brushes: ['Xml', 'JScript', 'CSharp', 'Plain', 'Php'],
			ready: function() {
				$.beautyOfCode.beautifyAll();
			}
		});
	</script>
